add_subdirectory("./util")
add_subdirectory("./tshark")
add_subdirectory("./sql")
add_subdirectory("./controller")

add_executable(${PROJECT_NAME}
    main.cpp)


target_include_directories(${PROJECT_NAME} PRIVATE
    ${tshark_SOURCE_DIR}/
    ${pugixml_SOURCE_DIR}/src
    ${jsoncpp_SOURCE_DIR}/include
    ${FMT_SOURCE_DIR}/include/
    ${util_SOURCE_DIR}/
    ${httplib_SOURCE_DIR}/
    ${3rd}/ # 在上一级CMakeLists.txt中声明
    ${controller_SOURCE_DIR}
    
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    jsoncpp_static
    tshark-static
    fmt::fmt-header-only
    ip2region-static
    pugixml::pugixml
    loguru-static
    # ws2_32 # windows下需要
    # dl # Linux下需要
    # pthread # Linux下需要
    util-shared
    sqlite3
    controller
)

# unix、Windows下需要链接不同的库
if(${CMAKE_HOST_UNIX})
    target_link_libraries(${PROJECT_NAME} PRIVATE
        dl # Linux下需要
    )
elseif(${CMAKE_HOST_WIN32})
    target_link_libraries(${PROJECT_NAME} PRIVATE
        ws2_32 # windows下需要
    )
endif()

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")

    target_link_libraries(${PROJECT_NAME} PRIVATE
        pthread # gcc下需要
    )
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
endif()

